package com.bootx.service.impl;

import com.bootx.entity.Image;
import com.bootx.service.ImageService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ImageServiceImpl extends BaseServiceImpl<Image,Long> implements ImageService {

    @Override
    public Image findBySn(String sn) {
        List<Map<String, Object>> maps = jdbcTemplate.queryForList("select id from image where sn=?", sn);
        if (!maps.isEmpty()) {
            return super.find(Long.valueOf(maps.getFirst().get("id")+""));
        }
        return null;
    }
}
